using FineCollection.Intf;




namespace FineCollection.Immutable
{
    /// <summary>
    /// Immutable set. 
    /// All items are different, nulls are not allowed.
    /// </summary>
    /// <typeparam name="T">type of an item.</typeparam>
    public class ImmList<T> : ImmArray<T>, RRandomList<T> 
        where T: System.IEquatable<T>
    {
        #region CONSTRUCTORS

        /// <summary>
        /// Makes an immutable set with 2 items.
        /// </summary>
        /// <param name="firstIndex">the origin index.</param>
        /// <param name="items">items, can be null or an empty array.</param>
        /// <remarks>
        /// Given items must be different and not null.
        /// </remarks>
        public ImmList(int firstIndex, params T[] items) 
            : base(firstIndex, items, arrSize(items), false)
        {}

        private static int arrSize(T[] array)
        {
            return array != null ? array.Length : 0;
        }

        #endregion



        /*
        /// <summary>
        /// Checks whether the specified item presents in this collection.
        /// </summary>
        /// <param name="item">items to check for presence.</param>
        /// <remarks>
        /// The complexity of this function is <i>o(n)</i>.
        /// </remarks>
        public bool Contains(T item)
        {
            for (int i = 0; i < count; i++)
                if (arr[i].Equals(item))
                    return true;
            return false;
        }
        */







    }
}